<?php
	class doudizhu{
		//const
		protected $tnum = 54;
		protected $type = array('♠️','♥️','♣️','♦️');
		protected $pai = array('2','3','4','5','6','7','8','9','10','J','Q','K','A');
		protected $allPai = array();//牌容器

		//准备一副牌
		public function createPia(){
			foreach ($this->pai as $value) {
				foreach ($this->type as $val) {
					# code...
					$this->allPai[] = $val.$value;
				}
			}
			array_push($this->allPai,'小王','大王');
		}

		//发牌
		public function fapai($num = 17){
			if($num <= 0){
				return  false;
			}
			$randT = array_rand($this->allPai,$num);
			$pai = array();
			foreach ($randT as $value) {
				# code...
				$pai[] = $this->allPai[$value];
				unset($this->allPai[$value]);
			}
			return $pai;
		}

		//获取底牌
		public function getdipai(){
			return $this->allPai;
		}


	}


	$Obj = new doudizhu();

	$Obj->createPia();

	$one = $Obj->fapai();
	$two = $Obj->fapai();
	$thr = $Obj->fapai();
	$dipai = $Obj->getdipai();



?>